from db import Session
from db.bidding import Admin

def getIdByAccount(account):
    """
    根据admin的account获取记录的id
    :param account:
    :return:
    """
    session = Session()
    try:
        adminId = session.query(Admin.id).filter(Admin.userName == account).scalar()
        if adminId:
            return adminId
        else:
            return -1
    except:
        session.rollback()
        return -1
    finally:
        session.close()